<?
header("Content-type: application/vnd.ms-excel");
//header("Content-disposition: csv" . date("Y-m-d") . ".xls");
header( "Content-disposition: filename=$act.$extype");

$glue = '';
if ($extype == 'xls') $glue = "\t"; 
if ($extype == 'csv') $glue = ',';

//$flds = array('staff_name','bil_pelawat');
$arr = array("Bulan","Jumlah Pelawat");
$csv_output = join("$glue",$arr) . "\n"; 

for ($i=0;$i<count($the_months);$i++) {
	$arr = array();
	$arr[] = $the_months[$i] . " $year";
	$arr[] = $the_values[$i];
	$csv_output .= join("$glue",$arr) . "\n";
}
print $csv_output;
exit; 
?>